package com.lagou.edu.user.controller;

import com.lagou.edu.user.api.UserRemoteService;
import com.lagou.edu.user.api.dto.UserDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * TODO
 *
 * @author lm
 * @since 2021/10/18 15:28
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    UserRemoteService userRemoteService;

    @GetMapping("/getAllUsers")
    public List<UserDTO> getAllUsers() {
        return userRemoteService.getAllUsers();
    }

    @GetMapping("/getUserByPhone")
    public UserDTO getUserByPhone(@RequestParam("phone") String phone) {
        return userRemoteService.getUserByPhone(phone);
    }

    @GetMapping("/isRegister")
    boolean isRegister(@RequestParam("phone") String phone) {
        return userRemoteService.isRegister(phone);
    }
}
